package top.maven;

import java.lang.reflect.Proxy;

/**
 * 动态代理
 */
public class Main {

    public static void main(String[] args) {
        UserService userService = new UserServiceImpl();
        UserInvocationHander hander = new UserInvocationHander(userService);
        UserService userServiceProxy = (UserService) Proxy.newProxyInstance(userService.getClass().getClassLoader(),
                userService.getClass().getInterfaces(), hander);
        String name = userServiceProxy.test();
        System.out.println(name);



    }



}

